From: Marco Trevisan (TreviƱo) Date: Tue, 28 May 2019 20:58:35 +0000 (+0200) Subject: polkitAgent: Inherit AuthenticationAgent from Shell.PolkitAuthenticationAgent X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~443 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0ed702d1afaec4c674df42038830a013e6f6d168;p=gnome-shell.git polkitAgent: Inherit AuthenticationAgent from Shell.PolkitAuthenticationAgent AuthenticationAgent is just a wrapper of Shell's PolkitAuthenticationAgent, so instead of using composition we can simply extend the base GObject. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/563 --- diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js index 8759400ef..b7321a0a1 100644 --- a/js/ui/components/polkitAgent.js +++ b/js/ui/components/polkitAgent.js @@ -369,19 +369,20 @@ var AuthenticationDialog = GObject.registerClass({ } }); -var AuthenticationAgent = class { - constructor() { +var AuthenticationAgent = GObject.registerClass( +class AuthenticationAgent extends Shell.PolkitAuthenticationAgent { + _init() { + super._init(); + this._currentDialog = null; - this._handle = null; - this._native = new Shell.PolkitAuthenticationAgent(); - this._native.connect('initiate', this._onInitiate.bind(this)); - this._native.connect('cancel', this._onCancel.bind(this)); + this.connect('initiate', this._onInitiate.bind(this)); + this.connect('cancel', this._onCancel.bind(this)); this._sessionUpdatedId = 0; } enable() { try { - this._native.register(); + this.register(); } catch (e) { log('Failed to register AuthenticationAgent'); } @@ -389,7 +390,7 @@ var AuthenticationAgent = class { disable() { try { - this._native.unregister(); + this.unregister(); } catch (e) { log('Failed to unregister AuthenticationAgent'); } @@ -439,8 +440,8 @@ var AuthenticationAgent = class { Main.sessionMode.disconnect(this._sessionUpdatedId); this._sessionUpdatedId = 0; - this._native.complete(dismissed); + this.complete(dismissed); } -}; +}); var Component = AuthenticationAgent;